<!-- 电子对账单 -->
<template>
    <div class="page has-navbar storeBill">
        <div class="page-content">
            <div class="time-filter" :style="nowType=='DAY'?'display:none;':'display:inherit;'">
<!--                 
                <div class="start-time time-filter-sty">
                    <span>请选择起始时间：</span>
                    <el-date-picker
                        v-model="value1"
                        type="datetime"
                        placeholder="选择日期时间">
                    </el-date-picker>
                </div> -->
                <div class="start-time time-filter-sty" >
                    <!-- <div class="time" @click="$refs.pickerForStart.open()"> -->
                    <div class="time">
                        <span>请选择起始日期：</span>
                        {{new Date(startTime).Format('yyyy-MM-dd')}}
                        <input id="start" type="text" readonly="" v-model="valForStart" style="opacity:0;position:absolute;top:0;width:100%;height:100%;"  placeholder="请选择时间" data-lcalendar="2016-05-11,2099-05-11" />
                    </div>
                    
                    <!-- <div class="sec">
                        <input type="tel" v-model="secStart" style="font-size:12px;" placeholder="设置秒钟" />
                    </div> -->
                </div>
                <div class="start-time time-filter-sty" >
                    <!-- <div class="time" @click="$refs.pickerForStart.open()"> -->
                    <div class="time">
                        <span>起始时间(选填)：</span>
                        {{timeForStartT}}
                        <!-- <input id="startTime" type="text" readonly="" v-model="valForStartT" style="opacity:0;position:absolute;top:0;width:100%;height:100%;"  placeholder="请选择时间"  /> -->
                        <input id="startTime" type="text" readonly="" v-model="valForStartT"  name="input_date" style="opacity:0;position:absolute;top:0;width:100%;height:100%;" placeholder="请选择时间" />
                    </div>
                    
                    <!-- <div class="sec">
                        <input type="tel" v-model="secStart" style="font-size:12px;" placeholder="设置秒钟" />
                    </div> -->
                </div>
                <div class="end-time time-filter-sty" >
                    <!-- <div class="time" @click="$refs.pickerForEnd.open()"> -->
                    <div class="time">
                        <span>请选择结束日期：</span>
                        {{new Date(endTime).Format('yyyy-MM-dd')}}
                        <!-- {{endTime}} -->
                        <input id="end" type="text" readonly="" v-model="valForEnd" style="opacity:0;position:absolute;top:0;width:100%;height:100%;"  placeholder="请选择时间" data-lcalendar="2016-05-11,2099-05-11" />
                    </div>
                    <!-- <div class="sec"> 
                        <input type="tel" v-model="secEnd" style="font-size:12px;"  placeholder="设置秒钟" />
                    </div> -->
                </div>
                <div class="end-time time-filter-sty" >
                    <!-- <div class="time" @click="$refs.pickerForEnd.open()"> -->
                    <div class="time">
                        <span>结束时间(选填)：</span>
                        {{timeForEndT}}
                        <!-- {{endTime}} -->
                        <!-- <input id="endTime" type="text" readonly="" v-model="valForEndT" style="opacity:0;position:absolute;top:0;width:100%;height:100%;"  placeholder="请选择时间"  /> -->
                        <input id="endTime" type="text" readonly="" v-model="valForEndT"  name="input_date" style="opacity:0;position:absolute;top:0;width:100%;height:100%;" placeholder="请选择时间" />
                    </div>
                    <!-- <div class="sec"> 
                        <input type="tel" v-model="secEnd" style="font-size:12px;"  placeholder="设置秒钟" />
                    </div> -->
                </div>
                <!-- <mt-datetime-picker
                    ref="pickerForStart"
                    type="datetime"
                    v-model="startTime"
                    @confirm="handleConfirmForTimeRange"
                    >
                </mt-datetime-picker>
                <mt-datetime-picker
                    ref="pickerForEnd"
                    type="datetime"
                    v-model="endTime"
                    @confirm="handleConfirmForTimeRange"
                    >
                </mt-datetime-picker> -->
                <div class="search">
                    <button @click="searchByTimeRange">查询</button>
                </div>
            </div>
            <div class="time-filter" :style="nowType=='DAY'?'display:inherit;':'display:none;'">
                <!-- <div class="end-time time-filter-sty" @click="showTime"> -->
                <div class="end-time time-filter-sty">
                    <span>请选择时间：</span>
                    {{new Date(timeForDay).Format('yyyy-MM-dd')}}
                    <input id="day" type="text" readonly="" v-model="valForDay" style="opacity:0;position:absolute;top:0;width:100%;height:100%;"  placeholder="请选择时间" data-lcalendar="2016-05-11,2099-05-11" />
                </div>
                <div>
                </div>
                <!-- <div id="pickerForDayFa"> -->
                    <!-- <mt-datetime-picker
                        ref="pickerForDay"
                        type="date"
                        v-model="timeForDay"
                        @confirm="handleConfirmForDay"
                        >
                    </mt-datetime-picker> -->
                <!-- </div> -->
            </div>
            <div class="change-type" @click="nowType=='DAY'?nowType='TIME_RANGE':nowType='DAY'">
                <span>{{nowType=='DAY'?'按照时间段查询':'按天查询'}}</span>
            </div>
            <div class="bill-amount">
                <ul>
                    <li v-for="(item,index) in adminPayBill">
                        <span class="channel-color" :style="'background-color:'+item.color"></span>
                        <span class="amount-count">
                            {{item.name}}
                        </span>
                    </li>
                    <li>
                        <span class="channel-color" style="background-color:rgb(55,214,183);"></span>
                        <span class="amount-count">
                            退款:{{refundTotalAmount}}({{refundCount}}笔)
                        </span>
                    </li>
                </ul>
            </div>
            <div class="page-scroll">
                <div class="listTitle clearfix">
                    <div style="width:20%" class="left">实收</div>
                    <div style="width:20%" class="left">应收</div>
                    <div style="width:20%" class="left">折扣</div>
                    <div style="width:20%" class="left">抹零</div>
                    <div style="width:20%" class="left">日期</div>
                </div>
                <scroll :class="nowType=='DAY'?'billList':'billList'"
                        :on-infinite="onInfinite">
                    <item v-for="(item, index) in billList" :key="index" @click.native="onItemClick(item)" class="billItem" :class="{'item-stable': index % 2 == 0}">
                        <div :style="nowType=='DAY'?'width:20%':'width:20%;line-height:28px;'" class="left" v-text="'￥'+item.amount"></div>
                        <div :style="nowType=='DAY'?'width:20%':'width:20%;line-height:28px;'" class="left" v-text="'￥'+item.total"></div>
                        <div :style="nowType=='DAY'?'width:20%':'width:20%;line-height:28px;'" class="left" v-text="'￥'+item.discount"></div>
                        <div :style="nowType=='DAY'?'width:20%':'width:20%;line-height:28px;'" class="left" v-text="'￥'+item.removeZero"></div>
                        <div style="width:20%;" v-if="item.amount<0" class="left">{{nowType=='DAY'?new Date(item.refundTime).Format('hh:mm:ss'):(new Date(item.refundTime).Format('yyyy-MM-dd hh:mm:ss'))}}</div>
                        <div style="width:20%;" v-else class="left">{{nowType=='DAY'?new Date(item.createTime).Format('hh:mm:ss'):(new Date(item.createTime).Format('yyyy-MM-dd hh:mm:ss'))}}</div>
                    </item>

                    <div v-if="!haveMore" slot="infinite" class="text-center">没有更多数据</div>
                </scroll>
            </div>
        </div>
        <div class="alert-mask" v-if="showDetail" @click="showDetail=false">
            <div class="order-detail" @click.stop="">
                <div class="tit">
                    <span>订单详情</span>
                </div>
                <div class="head">
                    <span>名称</span>
                    <span>数量</span>
                    <span>金额</span>
                </div>
                <div class="list">
                    <ul>
                        <li v-for="(item,index) in detailArr" :key="index">
                            <span class="name">{{item.productName}}</span>
                            <span class="count">{{item.qty}}</span>
                            <span class="amount">{{item.amount}}</span>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
        <!-- <date-time/> -->
    </div>
</template>

<script type="text/javascript">
// import dateTime from "./../../../../components/dateTime/dateTime";
// import "./lCalendar.js";
export default{
    props: ['storeId'],
    components: {
        // dateTime
    },
	data () {
		return {
            canClick:true,
            refundCount:0,
            refundTotalAmount:0,
            lastStartTime:"",
            lastEndTime:"",
            timeForStartT:"",
            timeForEndT:"",
            valForStartT:"",
            valForEndT:'',
            valForEnd:'',
            valForStart:"",
            valForDay:'',
            detailArr:[],
            showDetail:false,
            secStart:"",
            secEnd:"",
            isPage:false,
            adminPayBill:[],
            pickerValue:"",
            nowType:"DAY",
            refundAmount:0,//退单金额
            serviceChargeAmount:0,//手续费金额
            totalAmount:0,//总金额
            totalSingular:0,//总订单量
            sTime:'',
            eTime:'',
            startTime:"",
            timeForDay:"",
            endTime:"",
            billList: [],
            haveMore: true,
            pageSize: 100,
            curPage: 0,
            payType: {
                "CASH": "现金",
                "ALIPAY": "支付宝",
                "WECHATPAY": "微信",
                "UNIONPAY": "银联",
                "pay.weixin.micropay":"微信刷卡",
                "pay.wechat.micropay":"微信刷卡",
                "pay.alipay.micropay":"支付宝刷卡",
                "pay.jdpay.micropay":"京东刷卡",
                "pay.qq.micropay":"QQ钱包刷卡",
                "pay.shiming.micropay":"会员卡",
                "pay.unionpay.micropay":"银联支付",
                "pay.bestpay.micropay":"翼支付",
                "pay.weixin.native":"微信扫码",
                "pay.wechat.native":"微信扫码",
                "pay.alipay.native":"支付宝扫码",
                "ALIPAY_CASH":"支付宝线下",
                "WECHATPAY_CASH":"微信线下",
                "COUPON":"优惠券",
                "MEMBER":"会员",
                "pay.wechat.jspay":"微信网页支付",
                "pay.alipay.jspay":"支付宝网页支付",
            },
		}
    },
    watch:{
        valForStartT(val){
            console.log(val)
            this.timeForStartT = val;
        },
        valForEndT(val){
            this.timeForEndT = val;
        },
        valForDay(val){
            this.timeForDay = val;
        },
        valForEnd(val){
            this.endTime = val;
        },
        valForStart(val){
            this.startTime = val;
        },
        nowType(val){
            if(val == "DAY"){
                
                this.getData(0,this.timeForDay);
            }else{
                
                // this.getData(0,this.endTime,"TIME_RANGE");
            }
        },
        timeForDay(val){
            this.getData(0,this.timeForDay);
        },
        secStart(val){
            if(!/\d/.test(val)){
                $toast.show("起始秒钟错误,仅允许0-59秒", 3000);
                return;
            }
            if(Number(val) < 0 ||Number(val) > 59){
                $toast.show("起始秒钟错误,仅允许0-59秒", 3000);
                return;
            }
            
        },
        secEnd(val){
            if(!/\d/.test(val)){
                $toast.show("结束秒钟错误,仅允许0-59秒", 3000);
                return;
            }
            if(Number(val) < 0 ||Number(val) > 59){
                $toast.show("结束秒钟错误,仅允许0-59秒", 3000);
                return;
            }
            
        }
    //    startTime(val){
    //        let date = new Date().getTime() - 1000*60*60*24;
    //        if(new Date(val).getTime() > new Date(this.endTime).getTime()){
    //             $toast.show("起始时间不能大于截止时间或今天", 3000);
    //             return;
    //         }
    //         if(new Date(this.endTime).getTime() > date){
    //             $toast.show("只能查询今天之前的数据", 3000);
    //             return;
    //         }
    //         this.getData(val,this.endTime);
    //    },
    //    endTime(val){
    //        let date = new Date().getTime() - 1000*60*60*24;
    //        if(new Date(this.startTime).getTime() > new Date(val).getTime()){
    //             $toast.show("起始时间不能大于截止时间", 3000);
    //             return;
    //        }
    //         if(new Date(val).getTime() > date){
    //             $toast.show("只能查询今天之前的数据", 3000);
    //             return;
    //         }
    //         this.getData(this.startTime,val);
    //    }
    },
    methods: {
        searchByTimeRange(){

            // 
            let timeStr = new Date(this.startTime).getTime() + "-" + new Date(this.endTime).getTime();
            let nowTime = new Date().getTime();
            if(!(this.$canClickSelect("storeBillTimeRange",timeStr,nowTime))){
                $toast.show("30秒内禁止重复查询相同数据", 3000);
                return;
            }
            // 


            if(new Date((this.startTime+" 00:00:00").replace(/\-/g, "/")).getTime() > new Date((this.endTime+" 23:59:59").replace(/\-/g, "/")).getTime()){
                $toast.show("起始时间不能大于截止时间", 3000);
                return;
            }
            let stTime;
            let edTime
            if(this.timeForStartT){
                stTime=new Date((this.startTime+' '+this.timeForStartT).replace(/\-/g, "/")).getTime();
            }else{
                stTime=new Date((this.startTime+" 00:00:00").replace(/\-/g, "/")).getTime();
            }
            if(this.timeForEndT){
                edTime=new Date((this.endTime+' '+this.timeForEndT).replace(/\-/g, "/")).getTime();
            }else{
                let time;
                time =this.endTime.replace(/\-/g, "/");
                edTime=new Date((this.endTime+" 23:59:59").replace(/\-/g, "/")).getTime();
            }
            // let stTime = this.startTime;
            // let edTime = this.endTime;
            // alert(stTime);
            this.lastStartTime = stTime;
            this.lastEndTime = edTime;
            if((this.lastEndTime-this.lastStartTime) > (1000*60*60*24*35)){
                $toast.show("只允许查询35天以内的数据", 3000);
                return; 
            }
            if(this.canClick){
                this.canClick = false;
                this.getData(0,this.endTime,"TIME_RANGE");
            }
        },
        showTime(){
            console.log(this.$refs.pickerForDay.open);
            // this.$refs.pickerForDay.open();
        },
        setStartTime(val){
            console.log(val)
            this.startTime = val;
            // this.startTime=new Date(this.sTime).Format('yyyy-MM-dd');
            let date = new Date().getTime() - 1000*60*60*24;
            if(new Date(this.startTime).getTime() > new Date(this.endTime).getTime()){
                $toast.show("起始时间不能大于截止时间", 3000);
                return;
            }
            // if(new Date(this.endTime).getTime() > date){
            //     $toast.show("只能查询今天之前的数据", 3000);
            //     return;
            // }
            this.getData(this.startTime,this.endTime);
        },
        handleConfirmForDay(val){
            this.timeForDay = new Date(val).Format('yyyy-MM-dd');
            this.getData(0,this.timeForDay);
        },
        handleConfirmForTimeRange(val){
            console.log(val)
            // this.endTime = new Date(val).Format('yyyy-MM-dd hh:mm:ss');
            if(!this.startTime){
                $toast.show("请选择起始时间", 3000);
                return;
            }
            if(new Date(this.startTime).getTime() > new Date(this.endTime).getTime()){
                $toast.show("起始时间不能大于截止时间", 3000);
                return;
            }
            this.getData(0,this.endTime,"TIME_RANGE");
        },
        setEndTime(val){
            this.endTime = val;
            // this.startTime=new Date(this.sTime).Format('yyyy-MM-dd');
            let date = new Date().getTime() - 1000*60*60*24;
            if(new Date(this.startTime).getTime() > new Date(this.endTime).getTime()){
                $toast.show("起始时间不能大于截止时间", 3000);
                return;
            }
            if(new Date(this.endTime).getTime() > date){
                $toast.show("只能查询今天之前的数据", 3000);
                return;
            }
            this.getData(this.startTime,this.endTime);
        },
        getDataByNowTimeRange(){
            this.endTime=new Date(this.eTime).Format('yyyy-MM-dd');
            let date = new Date().getTime() - 1000*60*60*24;
            if(new Date(this.startTime).getTime() > new Date(this.endTime).getTime()){
                $toast.show("起始时间不能大于截止时间", 3000);
                return;
            }
            if(new Date(this.endTime).getTime() > date){
                $toast.show("只能查询今天之前的数据", 3000);
                return;
            }
            this.getData(this.startTime,this.endTime);
        },
        onInfinite(done) {
            this.curPage++;
            this.haveMore = true;
            this.isPage = true;
            if(this.nowType == "DAY"){
                this.timeForDay = new Date(this.timeForDay).Format('yyyy-MM-dd');
                this.getData(this.curPage,this.timeForDay,"DAY",done);
            }else{
                this.getData(this.curPage,this.endTime,"TIME_RANGE",done);
            }
            // this.$http({
            //     url:"third-party",
            //     method:"GET",
            //     params:{
            //         storeId:this.storeId,
            //         page:this.curPage,
            //         size:this.pageSize,
            //         from:this.startTime,
            //         to:this.endTime
            //     }
            // }).then((res)=>{
            //     if ( !res.data.electronicBills[0] ) {
            //         this.haveMore = false;
            //         this.curPage--;
            //         done();
            //         return;
            //     }
            //     this.billList = this.billList.concat(res.data.electronicBills);
            //     done();
            // }).catch(()=>{

            // })
        },

        numberToMonthDate: function (val) {
            let date = new Date(val);
            let dateStr = ((date.getMonth()+1)<10?('0'+(date.getMonth()+1)):(date.getMonth()+1))+'.'+(date.getDate()<10?'0'+date.getDate():date.getDate())+' '+ (date.getHours()<10?'0'+date.getHours():date.getHours()) + ':' + (date.getMinutes()<10?'0'+date.getMinutes():date.getMinutes());
            return dateStr;
        },

        onItemClick(item) {
            this.$http({
                url:"get-item",
                method:"GET",
                params:{
                   orderId:item.orderId
                }
            }).then(res=>{
                this.detailArr = res.data;
                this.showDetail = true;
            })
        },
        getData(page, date, type="DAY",done={}){
            let params;
            if(type=="DAY"){
                let time = new Date(date).Format("yyyy-MM-dd");
                params = {
                    storeId: this.storeId,
                    time,
                    page: page,
                    size: this.pageSize,
                    source: "store",
                    type
                };
            }else{
                // if(this.secEnd){
                //     if(!/\d/.test(this.secEnd)){
                //         $toast.show("结束秒钟错误", 3000);
                //         return;
                //     }
                //     if(Number(this.secEnd) < 0 ||Number(this.secEnd) > 59){
                //         $toast.show("结束秒钟错误", 3000);
                //         return;
                //     }
                //     let sec = Number(this.secEnd)*1000;
                //     let date = new Date(this.endTime);
                //     this.endTime = date.getTime() + sec;
                // }
                // if(this.secStart){
                //     if(!/\d/.test(this.secStart)){
                //         $toast.show("起始秒钟错误", 3000);
                //         return;
                //     }
                //     if(Number(this.secStart) < 0 ||Number(this.secStart) > 59){
                //         $toast.show("起始秒钟错误", 3000);
                //         return;
                //     }
                //     let sec = Number(this.secStart)*1000;
                //     let date = new Date(this.startTime);
                //     this.startTime = date.getTime() + sec;
                // }
                let begin = new Date(this.lastStartTime).Format("yyyy-MM-dd hh:mm:ss");
                let end = new Date(this.lastEndTime).Format("yyyy-MM-dd hh:mm:ss");
                // alert(this.lastStartTime);
                params = {
                    storeId: this.storeId,
                    // time: date,
                    page: page,
                    size: this.pageSize,
                    source: "store",
                    type,
                    begin,
                    end
                };
            }
                this.$http({
                    url: "get-storeBill",
                    method:"GET",
                    params
                }).then(res=>{
                    setTimeout(()=>{
                        this.canClick = true;
                    },500);
                    this.refundTotalAmount = res.data.refundTotalAmount;
                    this.refundCount = res.data.refundCount;
                    if(this.secStart){
                        let sec = Number(this.secStart)*1000;
                        let date = new Date(this.startTime);
                        this.startTime = date.getTime() - sec;
                    }
                    if(this.secEnd){
                        let secForEnd = Number(this.secEnd)*1000;
                        let dateForEnd = new Date(this.endTime);
                        this.endTime = dateForEnd.getTime() - secForEnd;
                    }

                    if(this.isPage){
                        console.log("j")
                        this.billList = this.billList.concat(res.data.data);
                        if ( !res.data.data.length ) {
                            this.haveMore = false;
                            this.curPage--;
                            done();
                            this.isPage = false;
                            return;
                        }
                        done();
                    }else{
                        this.billList = res.data.data;
                    }
                    let adminPayBill = JSON.parse(res.data.adminPayBill);
                    // this.adminPayBill = adminPayBill.adminPayBill;
                    let incomeData = [];
                    for (let i = 0; i < adminPayBill.adminPayBill.length; i++) {
                    let amountObj = {};
                    amountObj.value = Number(adminPayBill.adminPayBill[i].amount).toFixed(2);
                    amountObj.count = adminPayBill.adminPayBill[i].count;
                    switch (adminPayBill.adminPayBill[i].channel) {
                        
                        case "jdMicroPay":
                        amountObj.name = "京东刷卡";
                        amountObj.color =  "#d17c42";
                        break;
                    
                        case "qqMicroPay":
                        amountObj.name = "QQ钱包刷卡";
                        amountObj.color = "#b3c125";
                        break;
                    
                        case "smMicroPay":
                        amountObj.name = "会员卡";
                        amountObj.color = "#1c9cba";
                        break;
                        
                        case "unionPay":
                        amountObj.name = "银联支付";
                        amountObj.color = "#ff9e9c";
                        break;
                        
                        case "wingPayAmount":
                        amountObj.name = "翼支付";
                        amountObj.color ="#ea7f5e";
                        break;
                    
                        case "CASH":
                        amountObj.name = "现金";
                        amountObj.color = "#3bbddb" ;
                        break;
                        case "cashAmount":
                        amountObj.name = "现金";
                        amountObj.color = "#3bbddb";
                        break;
                        case "WECHATPAY":
                        amountObj.name = "微信";
                        amountObj.color = "#51c332" ;
                        break;
                        case "wechatAmount":
                        amountObj.name = "微信";
                        amountObj.color =  "#51c332";
                        break;
                        case "ALIPAY":
                        amountObj.name = "支付宝";
                        amountObj.color = "#d69947" ;
                        break;
                        case "alipayAmount":
                        amountObj.name = "支付宝";
                        amountObj.color =  "#56abe4" ;
                        break;
                        case "UNIONPAY":
                        amountObj.name = "银联";
                        amountObj.color = "#ff9e9c" ;
                        break;
                        case "ALIPAY_CASH":
                        amountObj.name = "支付宝线下";
                        amountObj.color = "#d69947" ;
                        break;
                        case "WECHATPAY_CASH":
                        amountObj.name = "微信线下";
                        amountObj.color = "#51c332";
                        break;
                        case "COUPON":
                        amountObj.name = "优惠券";
                        amountObj.color = "#619ce2";
                        break;
                        case "couponAmount":
                        amountObj.name = "优惠券";
                        amountObj.color =  "#619ce2";
                        break;
                        case "MEMBER":
                        amountObj.name = "会员";
                        amountObj.color =  "#1c9cba";
                        break;
                        case "memberAmount":
                        amountObj.name = "会员";
                        amountObj.color = "#1c9cba";
                        break;
                        case "memberRechargeAmount":
                        amountObj.name = "会员充值";
                        amountObj.color = "#1c9cba";
                        break;
                        default:
                        break;
                    }
                    amountObj.name = `${amountObj.name}:${amountObj.value}元(${amountObj.count}笔)`;
                    // amountObj[adminPayBill.amount[i][0]] =  adminPayBill.amount[i][1];
                    incomeData.push(amountObj);
                }
                this.adminPayBill = incomeData;
                console.log(res.data)
                    if ( res.data.data.length < this.pageSize || res.data == {}) {
                        this.haveMore = false;
                    }
                }).catch(()=>{

                })
            }
    },
    created(){
        
        // this.$http.get('/third-party?storeId='+this.storeId+'&page='+this.curPage+'&size='+this.pageSize).then((res)=>{
        //     this.billList = res.data.electronicBills;
        //     if ( res.data.electronicBills.length < this.pageSize ) {
        //         this.haveMore = false;
        //     }
        // }).catch(()=>{

        // })
    },
    updated () {
        // if(this.nowType != "DAY"){
        //     var calendarForStart = new lCalendar();
        //     var calendarForEnd = new lCalendar();
        //     calendarForStart.init({
        //         'trigger': '#start', //标签id
        //         'type': 'date', //date 调出日期选择 datetime 调出日期时间选择 time 调出时间选择 ym 调出年月选择,
        //         'minDate': '2016-9-9', //最小日期
        //         'maxDate': '2099-9-9' //最大日期
        //     });
        //     calendarForEnd.init({
        //         'trigger': '#end', //标签id
        //         'type': 'date', //date 调出日期选择 datetime 调出日期时间选择 time 调出时间选择 ym 调出年月选择,
        //         'minDate': '2016-9-9', //最小日期
        //         'maxDate': '2099-9-9' //最大日期
        //     });
        // }else{
        //     calendar = new lCalendar();
        //     calendar.init({
        //         'trigger': '#day', //标签id
        //         'type': 'date', //date 调出日期选择 datetime 调出日期时间选择 time 调出时间选择 ym 调出年月选择,
        //         'minDate': '2016-9-9', //最小日期
        //         'maxDate': '2099-9-9' //最大日期
        //     });
        // }
    },
    mounted(){
        document.title = "对账单";
        // let date = new Date().getTime();
        // let dateForDay = new Date().getTime();
        let dateForDay = new Date().Format('yyyy/MM/dd');
        let date = new Date().Format('yyyy/MM/dd');
        console.log(date)
        this.startTime = date;
        this.endTime = date;
        this.timeForDay = dateForDay;
        this.sTime = date;
        this.eTime = date;
        this.getData(0,new Date(this.timeForDay).Format('yyyy-MM-dd'));
        var calendar = new lCalendar();
        calendar.init({
            'trigger': '#day', //标签id
            'type': 'date', //date 调出日期选择 datetime 调出日期时间选择 time 调出时间选择 ym 调出年月选择,
        });

        var calendarForStart = new lCalendar();
        var calendarForEnd = new lCalendar();
        var calendarForStartT = new lCalendar();
        var calendarForEndT = new lCalendar();
        calendarForStart.init({
            'trigger': '#start', //标签id
            'type': 'date', //date 调出日期选择 datetime 调出日期时间选择 time 调出时间选择 ym 调出年月选择,
            'minDate': '2016-9-9', //最小日期
            'maxDate': '2099-9-9' //最大日期
        });
        calendarForEnd.init({
            'trigger': '#end', //标签id
            'type': 'date', //date 调出日期选择 datetime 调出日期时间选择 time 调出时间选择 ym 调出年月选择,
            'minDate': '2016-9-9', //最小日期
            'maxDate': '2099-9-9' //最大日期
        });
        calendarForStartT.init({
            'trigger': '#startTime', //标签id
            'type': 'time', //date 调出日期选择 datetime 调出日期时间选择 time 调出时间选择 ym 调出年月选择,
        });
        calendarForEndT.init({
            'trigger': '#endTime', //标签id
            'type': 'time', //date 调出日期选择 datetime 调出日期时间选择 time 调出时间选择 ym 调出年月选择,
        });
        
    }
}
</script>
<style lang="scss" scoped>
    @import "./storeBill.scss";
    // @import "./lCalendar.css";
</style>
